import oriData from './UseSchoolData/student.json'

function GetDataBySchoolAndYear (Index) {
  var schoolId = 0  //get corresponding school_id
  switch (Index.School) {
    case "浙江大学":
      schoolId = 1
      break

    case "北京大学":
      schoolId = 2
      break

    case "清华大学":
      schoolId = 3
      break

    case "哈尔滨工业大学":
      schoolId = 4
      break

    case "复旦大学":
      schoolId = 5
      break

    case "上海交通大学":
      schoolId = 6
      break

    case "南京大学":
      schoolId = 7
      break

    case "中国科学技术大学":
      schoolId = 8
      break

    case "西安交通大学":
      schoolId = 9
      break
  }
  var filter1 = oriData.filter(v => v.school_id == schoolId) //filter the school_id
  var Data = [];
  filter1.forEach((element) => {
    if (element.year == Index.Year) {
      Data.push({name:element.location,num:element.number});
    }
  });
//   console.log(Data.length);
  return Data;
}
export default GetDataBySchoolAndYear